<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ page import="com.semanticvoid.lifelogger.configuration.Constants" %>
<%@ page import="com.semanticvoid.lifelogger.db.DbInterface" %>
<%@ page import="com.semanticvoid.lifelogger.metrics.plot.MetricPlotter" %>

<%
int browseCount = MetricPlotter.getCountOfItemsInSystem(Constants.ITEM_TYPE_FOR_BROWSE);
int blogCount = MetricPlotter.getCountOfItemsInSystem(Constants.ITEM_TYPE_FOR_READ_BLOG);
int bkmkCount = MetricPlotter.getCountOfItemsInSystem(Constants.ITEM_TYPE_FOR_BOOKMARK);
int clickThruCount = MetricPlotter.getCountOfItemsInSystem(Constants.ITEM_TYPE_FOR_SEARCH_CLICKTHRU);
int searchCount = MetricPlotter.getCountOfItemsInSystem(Constants.ITEM_TYPE_FOR_SEARCH_QUERY);
%>

<div>
    <div><canvas id="snapshotgraph" height="350" width="400"></canvas></div>
</div>

<script type="text/javascript">       
        var options = {
               "colorScheme": PlotKit.Base.baseDarkPrimaryColors(),
               "backgroundColor": Color.whiteColor(),
               "xTicks": [{v:0, label:"Browse"}, 
                        {v:1, label:"Blog"}, 
                        {v:2, label:"Bookmark"},
                        {v:3, label:"Clickthru"},
                        {v:4, label:"Search"}]
                };
        var layout = new Layout("bar", options );
        layout.addDataset("snapshot", [[0, <%= browseCount %>], [1, <%= blogCount %>], [2, <%= bkmkCount %>], [3, <%= clickThruCount %>], [4, <%= searchCount %>]]);
        layout.evaluate();
        
        var plotter = new SweetCanvasRenderer($("snapshotgraph"), layout, options);
        plotter.render();
</script>